

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Image Tools &mdash; agpy 0.1.2 documentation</title>
    
    <link rel="stylesheet" href="_static/extra.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="agpy 0.1.2 documentation" href="index.html" />
    <link rel="next" title="AG_fft_tools Package" href="fft_tools.html" />
    <link rel="prev" title="Adam Ginsburg’s Python Code (agpy)" href="agpy.html" />
     
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setDomainName', 'pyspeckit.bitbucket.org']);
      _gaq.push(['_setAllowHash', false]);
      _gaq.push(['_trackPageview']);


    </script>
    <link rel="stylesheet" type="text/css" href="_static/extra.css" />
  </head>
  <body>
    <div class="header-wrapper">
      <div class="header">
        <h1><a href="index.html">agpy 0.1.2 documentation</a></h1>
        <div class="rel">
          <a href="http://agpy.googlecode.com">agpy Home </a>  |
          <a href=index.html>Docs Home </a>  |
          <a href="http://code.google.com/p/agpy/w/list">Wiki</a>  |
          <a href=search.html>Search </a>
        </div>
       </div>
    </div>

    <div class="content-wrapper">
      <div class="content">
        <div class="document">
            
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="image-tools">
<h1>Image Tools<a class="headerlink" href="#image-tools" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-AG_image_tools">
<span id="ag-image-tools-package"></span><h2><a class="reference internal" href="#module-AG_image_tools" title="AG_image_tools"><tt class="xref py py-mod docutils literal"><span class="pre">AG_image_tools</span></tt></a> Package<a class="headerlink" href="#module-AG_image_tools" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-AG_image_tools.drizzle">
<span id="drizzle-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">drizzle</span></tt> Module<a class="headerlink" href="#module-AG_image_tools.drizzle" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="AG_image_tools.drizzle.drizzle">
<tt class="descclassname">AG_image_tools.drizzle.</tt><tt class="descname">drizzle</tt><big>(</big><em>tstomap</em>, <em>ts</em>, <em>mapshape</em>, <em>weights=1</em>, <em>weightmap=None</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/drizzle.html#drizzle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.drizzle.drizzle" title="Permalink to this definition">¶</a></dt>
<dd><p>Drizzle a timestream onto a map.  Returns the map of the weighted average
per pixel of the input timestream.
(note that this works for any 1D array with a same-size mapping to an
image; I&#8217;ve written it with timestreams in mind though)</p>
<dl class="docutils">
<dt>tstomap - mapping from timestream -&gt; map.  len(tstomap) = len(ts)</dt>
<dd>Both tstomap and ts should be one-dimensional, but they&#8217;ll be raveled
if you don&#8217;t do it yourself</dd>
<dt>weights - needs to have the same dimensions as ts <em>or</em> be scalar</dt>
<dd>(default=1)</dd>
<dt>mapshape - [nx,ny] simple 2D map specification.  Make sure your map</dt>
<dd>includes all points mapped to</dd>
</dl>
<p>You can specify a weightmap to increase efficiency instead of computing it</p>
</dd></dl>

<dl class="function">
<dt id="AG_image_tools.drizzle.masktozero">
<tt class="descclassname">AG_image_tools.drizzle.</tt><tt class="descname">masktozero</tt><big>(</big><em>arr</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/drizzle.html#masktozero"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.drizzle.masktozero" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert all NANs or masked elements of an array to zero, and return a numpy
array (NOT a masked array).</p>
</dd></dl>

</div>
<div class="section" id="module-AG_image_tools.radialprofile">
<span id="radialprofile-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">radialprofile</span></tt> Module<a class="headerlink" href="#module-AG_image_tools.radialprofile" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="AG_image_tools.radialprofile.azimuthalAverage">
<tt class="descclassname">AG_image_tools.radialprofile.</tt><tt class="descname">azimuthalAverage</tt><big>(</big><em>image</em>, <em>center=None</em>, <em>stddev=False</em>, <em>returnradii=False</em>, <em>return_nr=False</em>, <em>binsize=0.5</em>, <em>weights=None</em>, <em>steps=False</em>, <em>interpnan=False</em>, <em>left=None</em>, <em>right=None</em>, <em>mask=None</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/radialprofile.html#azimuthalAverage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.radialprofile.azimuthalAverage" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the azimuthally averaged radial profile.</p>
<p>image - The 2D image
center - The [x,y] pixel coordinates used as the center. The default is</p>
<blockquote>
<div>None, which then uses the center of the image (including 
fractional pixels).</div></blockquote>
<p>stddev - if specified, return the azimuthal standard deviation instead of the average
returnradii - if specified, return (radii_array,radial_profile)
return_nr   - if specified, return number of pixels per radius <em>and</em> radius
binsize - size of the averaging bin.  Can lead to strange results if</p>
<blockquote>
<div>non-binsize factors are used to specify the center and the binsize is
too large</div></blockquote>
<dl class="docutils">
<dt>weights - can do a weighted average instead of a simple average if this keyword parameter</dt>
<dd>is set.  weights.shape must = image.shape.  weighted stddev is undefined, so don&#8217;t
set weights and stddev.</dd>
<dt>steps - if specified, will return a double-length bin array and radial</dt>
<dd>profile so you can plot a step-form radial profile (which more accurately
represents what&#8217;s going on)</dd>
<dt>interpnan - Interpolate over NAN values, i.e. bins where there is no data?</dt>
<dd>left,right - passed to interpnan; they set the extrapolated values</dd>
<dt>mask - can supply a mask (boolean array same size as image with True for OK and False for not)</dt>
<dd>to average over only select data.</dd>
</dl>
<p>If a bin contains NO DATA, it will have a NAN value because of the
divide-by-sum-of-weights component.  I think this is a useful way to denote
lack of data, but users let me know if an alternative is prefered...</p>
</dd></dl>

<dl class="function">
<dt id="AG_image_tools.radialprofile.azimuthalAverageBins">
<tt class="descclassname">AG_image_tools.radialprofile.</tt><tt class="descname">azimuthalAverageBins</tt><big>(</big><em>image</em>, <em>azbins</em>, <em>symmetric=None</em>, <em>center=None</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/radialprofile.html#azimuthalAverageBins"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.radialprofile.azimuthalAverageBins" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the azimuthal average over a limited range of angles 
kwargs are passed to azimuthalAverage</p>
</dd></dl>

<dl class="function">
<dt id="AG_image_tools.radialprofile.radialAverage">
<tt class="descclassname">AG_image_tools.radialprofile.</tt><tt class="descname">radialAverage</tt><big>(</big><em>image</em>, <em>center=None</em>, <em>stddev=False</em>, <em>returnAz=False</em>, <em>return_naz=False</em>, <em>binsize=1.0</em>, <em>weights=None</em>, <em>steps=False</em>, <em>interpnan=False</em>, <em>left=None</em>, <em>right=None</em>, <em>mask=None</em>, <em>symmetric=None</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/radialprofile.html#radialAverage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.radialprofile.radialAverage" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the radially averaged azimuthal profile.
(this code has not been optimized; it could be speed boosted by ~20x)</p>
<p>image - The 2D image
center - The [x,y] pixel coordinates used as the center. The default is</p>
<blockquote>
<div>None, which then uses the center of the image (including 
fractional pixels).</div></blockquote>
<p>stddev - if specified, return the radial standard deviation instead of the average
returnAz - if specified, return (azimuthArray,azimuthal_profile)
return_naz   - if specified, return number of pixels per azimuth <em>and</em> azimuth
binsize - size of the averaging bin.  Can lead to strange results if</p>
<blockquote>
<div>non-binsize factors are used to specify the center and the binsize is
too large</div></blockquote>
<dl class="docutils">
<dt>weights - can do a weighted average instead of a simple average if this keyword parameter</dt>
<dd>is set.  weights.shape must = image.shape.  weighted stddev is undefined, so don&#8217;t
set weights and stddev.</dd>
<dt>steps - if specified, will return a double-length bin array and azimuthal</dt>
<dd>profile so you can plot a step-form azimuthal profile (which more accurately
represents what&#8217;s going on)</dd>
<dt>interpnan - Interpolate over NAN values, i.e. bins where there is no data?</dt>
<dd>left,right - passed to interpnan; they set the extrapolated values</dd>
<dt>mask - can supply a mask (boolean array same size as image with True for OK and False for not)</dt>
<dd>to average over only select data.</dd>
</dl>
<p>If a bin contains NO DATA, it will have a NAN value because of the
divide-by-sum-of-weights component.  I think this is a useful way to denote
lack of data, but users let me know if an alternative is prefered...</p>
</dd></dl>

<dl class="function">
<dt id="AG_image_tools.radialprofile.radialAverageBins">
<tt class="descclassname">AG_image_tools.radialprofile.</tt><tt class="descname">radialAverageBins</tt><big>(</big><em>image</em>, <em>radbins</em>, <em>corners=True</em>, <em>center=None</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/AG_image_tools/radialprofile.html#radialAverageBins"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#AG_image_tools.radialprofile.radialAverageBins" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the radial average over a limited range of radii</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
        </div>
        <div class="sidebar">
          <h3>Table Of Contents</h3>
          <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="agpy.html">Adam Ginsburg&#8217;s Python Code (agpy)</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Image Tools</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#module-AG_image_tools"><tt class="docutils literal"><span class="pre">AG_image_tools</span></tt> Package</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-AG_image_tools.drizzle"><tt class="docutils literal"><span class="pre">drizzle</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-AG_image_tools.radialprofile"><tt class="docutils literal"><span class="pre">radialprofile</span></tt> Module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="fft_tools.html">AG_fft_tools Package</a></li>
<li class="toctree-l1"><a class="reference internal" href="plfit.html">plfit Package</a></li>
</ul>

          <h3 style="margin-top: 1.5em;">Search</h3>
          <form class="search" action="search.html" method="get">
            <input type="text" name="q" />
            <input type="submit" value="Go" />
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>
          <p class="searchtip" style="font-size: 90%">
            Enter search terms or a module, class or function name.
          </p>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

    <div class="footer">
      &copy; Copyright 2011, Adam Ginsburg.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2pre.
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-6253248-2']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>
        
    </div>
  </body>
</html>